﻿/******************************************************************************
 *  All Rights Reserved , Copyright (C) 2012 , EricHu. 
 *  作    者： EricHu
 *  创建时间： 2012-7-20 16:35:51
 ******************************************************************************/
//--------------------------------------------------------------------
// All Rights Reserved , Copyright (C) 2012 , gt TECH, Ltd.
//--------------------------------------------------------------------

using System;
using System.Data;

namespace RDIFramework.BusinessEntity
{
  using RDIFramework.Utilities;

 /// <summary>
 /// PiPermissionScopeEntity
 /// 数据集权限存储表
 ///
 /// 修改纪录
 ///
 ///		2012-03-02 版本：1.0 EricHu 创建主键。
 ///
 /// 版本：1.0
 ///
 /// <author>
 ///		<name>EricHu</name>
 ///		<date>2012-03-02</date>
 /// </author>
 /// </summary>
    [Serializable]
    public partial class PiPermissionScopeEntity
    {
        private int? id = null;
        /// <summary>
        /// 主键
        /// </summary>
        public int? Id
        {
            get
            {
                return this.id;
            }
            set
            {
                this.id = value;
            }
        }

        private String resourceCategory = string.Empty;
        /// <summary>
        /// 什么类型的
        /// </summary>
        public String ResourceCategory
        {
            get
            {
                return this.resourceCategory;
            }
            set
            {
                this.resourceCategory = value;
            }
        }

        private String resourceId = string.Empty;
        /// <summary>
        /// 什么资源
        /// </summary>
        public String ResourceId
        {
            get
            {
                return this.resourceId;
            }
            set
            {
                this.resourceId = value;
            }
        }

        private String targetCategory = string.Empty;
        /// <summary>
        /// 对什么类型的
        /// </summary>
        public String TargetCategory
        {
            get
            {
                return this.targetCategory;
            }
            set
            {
                this.targetCategory = value;
            }
        }

        private String targetId = string.Empty;
        /// <summary>
        /// 对什么资源
        /// </summary>
        public String TargetId
        {
            get
            {
                return this.targetId;
            }
            set
            {
                this.targetId = value;
            }
        }

        private int? permissionId = null;
        /// <summary>
        /// 有什么权限
        /// </summary>
        public int? PermissionId
        {
            get
            {
                return this.permissionId;
            }
            set
            {
                this.permissionId = value;
            }
        }
        private string permissionConstraint = null;
        /// <summary>
        /// 有什么权限
        /// </summary>
        public string PermissionConstraint
        {
            get
            {
                return this.permissionConstraint;
            }
            set
            {
                this.permissionConstraint = value;
            }
        }


        private DateTime? startDate = null;
        /// <summary>
        /// 開始生效日期
        /// </summary>
        public DateTime? StartDate
        {
            get
            {
                return this.startDate;
            }
            set
            {
                this.startDate = value;
            }
        }


        private DateTime? endDate = null;
        /// <summary>
        /// 结束生效日期
        /// </summary>
        public DateTime? EndDate
        {
            get
            {
                return this.endDate;
            }
            set
            {
                this.endDate = value;
            }
        }


        private int? enabled = 1;
        /// <summary>
        /// 有效
        /// </summary>
        public int? Enabled
        {
            get
            {
                return this.enabled;
            }
            set
            {
                this.enabled = value;
            }
        }

        private int? deleteMark = 0;
        /// <summary>
        /// 删除标记
        /// </summary>
        public int? DeleteMark
        {
            get
            {
                return this.deleteMark;
            }
            set
            {
                this.deleteMark = value;
            }
        }

        private String description = string.Empty;
        /// <summary>
        /// 描述
        /// </summary>
        public String Description
        {
            get
            {
                return this.description;
            }
            set
            {
                this.description = value;
            }
        }

        private DateTime? createOn = DateTime.Now;
        /// <summary>
        /// 创建日期
        /// </summary>
        public DateTime? CreateOn
        {
            get
            {
                return this.createOn;
            }
            set
            {
                this.createOn = value;
            }
        }

        private String createBy = string.Empty;
        /// <summary>
        /// 创建用户
        /// </summary>
        public String CreateBy
        {
            get
            {
                return this.createBy;
            }
            set
            {
                this.createBy = value;
            }
        }

        private String createUserId = string.Empty;
        /// <summary>
        /// 创建用户主键
        /// </summary>
        public String CreateUserId
        {
            get
            {
                return this.createUserId;
            }
            set
            {
                this.createUserId = value;
            }
        }

        private DateTime? modifiedOn = null;
        /// <summary>
        /// 修改日期
        /// </summary>
        public DateTime? ModifiedOn
        {
            get
            {
                return this.modifiedOn;
            }
            set
            {
                this.modifiedOn = value;
            }
        }

        private String modifiedBy = string.Empty;
        /// <summary>
        /// 修改用户
        /// </summary>
        public String ModifiedBy
        {
            get
            {
                return this.modifiedBy;
            }
            set
            {
                this.modifiedBy = value;
            }
        }

        private String modifyUserId = string.Empty;
        /// <summary>
        /// 修改用户主键
        /// </summary>
        public String ModifyUserId
        {
            get
            {
                return this.modifyUserId;
            }
            set
            {
                this.modifyUserId = value;
            }
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        public PiPermissionScopeEntity()
        {
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataRow">数据行</param>
        public PiPermissionScopeEntity(DataRow dataRow)
        {
            this.GetFrom(dataRow);
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataReader">数据流</param>
        public PiPermissionScopeEntity(IDataReader dataReader)
        {
            this.GetFrom(dataReader);
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataTable">数据表</param>
        public PiPermissionScopeEntity(DataTable dataTable)
        {
            this.GetFrom(dataTable);
        }

        /// <summary>
        /// 从数据表读取
        /// </summary>
        /// <param name="dataTable">数据表</param>
        public PiPermissionScopeEntity GetFrom(DataTable dataTable)
        {
            if ((dataTable == null) || (dataTable.Rows.Count == 0))
            {
                return null;
            }
            foreach (DataRow dataRow in dataTable.Rows)
            {
                this.GetFrom(dataRow);
                break;
            }
            return this;
        }

        /// <summary>
        /// 从数据行读取
        /// </summary>
        /// <param name="dataRow">数据行</param>
        public PiPermissionScopeEntity GetFrom(DataRow dataRow)
        {
            this.Id = BusinessLogic.ConvertToInt(dataRow[PiPermissionScopeTable.FieldId]);
            this.ResourceCategory = BusinessLogic.ConvertToString(dataRow[PiPermissionScopeTable.FieldResourceCategory]);
            this.ResourceId = BusinessLogic.ConvertToString(dataRow[PiPermissionScopeTable.FieldResourceId]);
            this.TargetCategory = BusinessLogic.ConvertToString(dataRow[PiPermissionScopeTable.FieldTargetCategory]);
            this.TargetId = BusinessLogic.ConvertToString(dataRow[PiPermissionScopeTable.FieldTargetId]);
            this.PermissionId = BusinessLogic.ConvertToInt(dataRow[PiPermissionScopeTable.FieldPermissionId]);
            this.PermissionConstraint = BusinessLogic.ConvertToString(dataRow[PiPermissionScopeTable.FieldPermissionConstraint]);
            this.StartDate = BusinessLogic.ConvertToDateTime(dataRow[PiPermissionScopeTable.FieldStartDate]);
            this.EndDate = BusinessLogic.ConvertToDateTime(dataRow[PiPermissionScopeTable.FieldEndDate]);
            this.Enabled = BusinessLogic.ConvertToInt(dataRow[PiPermissionScopeTable.FieldEnabled]);
            this.DeleteMark = BusinessLogic.ConvertToInt(dataRow[PiPermissionScopeTable.FieldDeleteMark]);
            this.Description = BusinessLogic.ConvertToString(dataRow[PiPermissionScopeTable.FieldDescription]);
            this.CreateOn = BusinessLogic.ConvertToDateTime(dataRow[PiPermissionScopeTable.FieldCreateOn]);
            this.CreateBy = BusinessLogic.ConvertToString(dataRow[PiPermissionScopeTable.FieldCreateBy]);
            this.CreateUserId = BusinessLogic.ConvertToString(dataRow[PiPermissionScopeTable.FieldCreateUserId]);
            this.ModifiedOn = BusinessLogic.ConvertToDateTime(dataRow[PiPermissionScopeTable.FieldModifiedOn]);
            this.ModifiedBy = BusinessLogic.ConvertToString(dataRow[PiPermissionScopeTable.FieldModifiedBy]);
            this.ModifyUserId = BusinessLogic.ConvertToString(dataRow[PiPermissionScopeTable.FieldModifyUserId]);
            return this;
        }

        /// <summary>
        /// 从数据流读取
        /// </summary>
        /// <param name="dataReader">数据流</param>
        public PiPermissionScopeEntity GetFrom(IDataReader dataReader)
        {
            this.Id = BusinessLogic.ConvertToInt(dataReader[PiPermissionScopeTable.FieldId]);
            this.ResourceCategory = BusinessLogic.ConvertToString(dataReader[PiPermissionScopeTable.FieldResourceCategory]);
            this.ResourceId = BusinessLogic.ConvertToString(dataReader[PiPermissionScopeTable.FieldResourceId]);
            this.TargetCategory = BusinessLogic.ConvertToString(dataReader[PiPermissionScopeTable.FieldTargetCategory]);
            this.TargetId = BusinessLogic.ConvertToString(dataReader[PiPermissionScopeTable.FieldTargetId]);
            this.PermissionId = BusinessLogic.ConvertToInt(dataReader[PiPermissionScopeTable.FieldPermissionId]);
            this.PermissionConstraint = BusinessLogic.ConvertToString(dataReader[PiPermissionScopeTable.FieldPermissionConstraint]);
            this.StartDate = BusinessLogic.ConvertToDateTime(dataReader[PiPermissionScopeTable.FieldStartDate]);
            this.EndDate = BusinessLogic.ConvertToDateTime(dataReader[PiPermissionScopeTable.FieldEndDate]);
            this.Enabled = BusinessLogic.ConvertToInt(dataReader[PiPermissionScopeTable.FieldEnabled]);
            this.DeleteMark = BusinessLogic.ConvertToInt(dataReader[PiPermissionScopeTable.FieldDeleteMark]);
            this.Description = BusinessLogic.ConvertToString(dataReader[PiPermissionScopeTable.FieldDescription]);
            this.CreateOn = BusinessLogic.ConvertToDateTime(dataReader[PiPermissionScopeTable.FieldCreateOn]);
            this.CreateBy = BusinessLogic.ConvertToString(dataReader[PiPermissionScopeTable.FieldCreateBy]);
            this.CreateUserId = BusinessLogic.ConvertToString(dataReader[PiPermissionScopeTable.FieldCreateUserId]);
            this.ModifiedOn = BusinessLogic.ConvertToDateTime(dataReader[PiPermissionScopeTable.FieldModifiedOn]);
            this.ModifiedBy = BusinessLogic.ConvertToString(dataReader[PiPermissionScopeTable.FieldModifiedBy]);
            this.ModifyUserId = BusinessLogic.ConvertToString(dataReader[PiPermissionScopeTable.FieldModifyUserId]);
            return this;
        }
    }
}
